home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / MotifApp / Extras / bounce / BouncingBall.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.9 KB  |  60 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. //////////////////////////////////////////////////////////
  22. // BouncingBall.h
  23. //////////////////////////////////////////////////////////
  24. #ifndef BOUNCINGBALL_H
  25. #define BOUNCINGBALL_H
  26. #include "Actor.h"
  27. #include "Xm/Xm.h"
  28.  
  29. class Stage;
  30.  
  31. class BouncingBall : public Actor {
  32.     
  33. protected:
  34.     
  35.     GC         _gc;      // GC need to draw the object
  36.     XPoint     _delta;   // The velocity in terms of dx,dy 
  37.     XRectangle _bounds;  // The bounding box of the ball
  38.     
  39.     // Called from the ColorChooser when the user has picked a color 
  40.     
  41.     static void colorSelectedCallback ( int   red, 
  42.                        int   green, 
  43.                        int   blue, 
  44.                        void *clientData );
  45.     
  46.     // Called from the ColorChooser if no color has been selected 
  47.     
  48.     static void canceledCallback ( void * );
  49.     
  50.     virtual void colorSelected ( int red, int green, int blue );
  51.     
  52. public:
  53.     
  54.     BouncingBall ( Stage *, char *);
  55.     
  56.     void nextFrame ( Drawable, Dimension, Dimension );  // Move to next frame, Draw one frame
  57.     void draw      ( Drawable );  // Draw one frame
  58. };
  59. #endif
  60.